package Application.UIEditApplication.xmlPrase
{
	import Application.UIEditApplication.def.Manager;

	public class ComponentXML
	{
		private var _data : Object;
		
		public function ComponentXML()
		{
		}
		
		public function prase() : void
		{
			_data = new Object;
			
			var orgXML : XML = Manager.Source.getXML("Component");
			
			for each(var element:XML in orgXML.elements("item"))
			{
				var objInfo : Object = new Object;
				objInfo["id"] = element.@id.toString();
				objInfo["imgURL"] = element.@imgURL.toString();
				
				_data[objInfo["id"]]=objInfo;
			}
			
		}
		
		public function get Data() : Object
		{
			return _data;
		}
		
		public function get DataToArray() : Array
		{
			var list : Array = [];
			
			for each(var info:Object in _data)
			{
				list.push(info);
			}
			
			if(list.length == 0)
			{
				list = null;
			}
			
			list.sortOn("id");
			
			return list;
		}
	}
}